
clear all


local path0="C:\Dropbox\GeneticsProject (1)\REStat\round_accepted_replication_files\"
local path1="C:\Dropbox\GeneticsProject (1)\REStat\round_accepted_replication_files\outregs"

capture cd "`path0'Workfiles"
set more off
use completed_data, clear


	* create settler mortality with the African data corrected based on Albouy
	capture drop logmort3
	gen logmort3=logmort2
	replace logmort3=logmort if countrycode=="SGP" | countrycode=="AUS"
	
	gen lnUKdist=log(geo_UK_distw)

	capture drop ln_eiu_ppm
	gen ln_eiu_ppm=log(eiu_ppm)			
	

	
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Table 7: Extended list of controls
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	

	* output per worker
	xi: reg pwt_ln_rgdpwok idv ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati euro1900 intensive_fe lagsprecise_fe, robust 
	outreg2 idv wvs_trust icrg_ERR_mean yr_sch_1970 ef  lnUKdist legor_fr legor_ge legor_sc euro1900 intensive_fe lagsprecise_fe  using "`path1'\RR_table005.txt" , ///
		replace bdec(3) rdec(3) aster nocons nolabel ctitle("Y/L OLS: all") 	
	
	xi: ivreg2 pwt_ln_rgdpwok ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean  i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati euro1900 intensive_fe lagsprecise_fe (idv = distM_UK) , robust ffirst
	matrix A=e(first)
	local R2first=A[2,1]
	local Ffirst =A[3,1]
	outreg2 idv wvs_trust icrg_ERR_mean yr_sch_1970 ef  lnUKdist legor_fr legor_ge legor_sc euro1900 intensive_fe lagsprecise_fe using "`path1'\RR_table005.txt" , ///
		append bdec(3) rdec(3) aster nocons nolabel ctitle("Y/L IV: all") ///
		addstat("1st stage F-stat", `Ffirst',"Partial R2",`R2first')
		
	xi: condivreg pwt_ln_rgdpwok ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean  i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati  euro1900 intensive_fe lagsprecise_fe (idv = distM_UK)
	condtest, level(99) reps(2000) 
	condtest, level(95) reps(2000) 
	
	* patents
	xi: reg ln_eiu_ppm idv ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati euro1900 intensive_fe lagsprecise_fe, robust 
	outreg2 idv wvs_trust icrg_ERR_mean yr_sch_1970 ef  lnUKdist legor_fr legor_ge legor_sc euro1900 intensive_fe lagsprecise_fe  using "`path1'\RR_table005.txt" , ///
		append bdec(3) rdec(3) aster nocons nolabel ctitle("patents OLS: all") 	
	
	xi: ivreg2 ln_eiu_ppm ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean  i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati euro1900 intensive_fe lagsprecise_fe (idv = distM_UK) , robust ffirst
	matrix A=e(first)
	local R2first=A[2,1]
	local Ffirst =A[3,1]
	outreg2 idv wvs_trust icrg_ERR_mean yr_sch_1970 ef  lnUKdist legor_fr legor_ge legor_sc euro1900 intensive_fe lagsprecise_fe using "`path1'\RR_table005.txt" , ///
		append bdec(3) rdec(3) aster nocons nolabel ctitle("patents IV: all") ///
		addstat("1st stage F-stat", `Ffirst',"Partial R2",`R2first')
		
		
	xi: condivreg ln_eiu_ppm ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean  i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati  euro1900 intensive_fe lagsprecise_fe (idv = distM_UK)
	condtest, level(99) reps(1000) 
	
	* TFP - Hall/Jones (1999)
	xi: reg hjtfp idv ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati euro1900 intensive_fe lagsprecise_fe, robust 
	outreg2 idv wvs_trust icrg_ERR_mean yr_sch_1970 ef  lnUKdist legor_fr legor_ge legor_sc euro1900 intensive_fe lagsprecise_fe  using "`path1'\RR_table005.txt" , ///
		append bdec(3) rdec(3) aster nocons nolabel ctitle("patents OLS: all") 	
	
	xi: ivreg2 hjtfp ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean  i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati  euro1900 intensive_fe lagsprecise_fe (idv = distM_UK) , robust ffirst
	matrix A=e(first)
	local R2first=A[2,1]
	local Ffirst =A[3,1]
	outreg2 idv wvs_trust icrg_ERR_mean yr_sch_1970 ef  lnUKdist legor_fr legor_ge legor_sc euro1900 intensive_fe lagsprecise_fe using "`path1'\RR_table005.txt" , ///
		append bdec(3) rdec(3) aster nocons nolabel ctitle("patents IV: all") ///
		addstat("1st stage F-stat", `Ffirst',"Partial R2",`R2first')		
		
	
	xi: condivreg hjtfp ef yr_sch_1970 lnUKdist legor_fr legor_ge legor_sc wvs_trust icrg_ERR_mean  i.continent barro_prot_70-barro_nonrel_70 landlocked abs_long abs_lati  euro1900 intensive_fe lagsprecise_fe (idv = distM_UK)
	condtest, level(99) reps(1000) 
